//
//  HSDefine.h
//  HSTS
//
//  Created by simon on 2017/1/23.
//  Copyright © 2017年 simon. All rights reserved.
//

#ifndef HSDefine_h
#define HSDefine_h

#define IS_IPAD (UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPad)
#define IS_IPHONE (UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPhone)
#define IS_RETINA ([[UIScreen mainScreen] scale] >= 2.0)
#define kCurrentSystemVersion [[[UIDevice currentDevice] systemVersion] floatValue]

#define SCREEN_WIDTH ([[UIScreen mainScreen] bounds].size.width)
#define SCREEN_HEIGHT ([[UIScreen mainScreen] bounds].size.height)
#define SCREEN_MAX_LENGTH (MAX(SCREEN_WIDTH, SCREEN_HEIGHT))
#define SCREEN_MIN_LENGTH (MIN(SCREEN_WIDTH, SCREEN_HEIGHT))

#define IS_IPHONE_4_OR_LESS (IS_IPHONE && SCREEN_MAX_LENGTH < 568.0)
#define IS_IPHONE_5 (IS_IPHONE && SCREEN_MAX_LENGTH == 568.0)
#define IS_IPHONE_6 (IS_IPHONE && SCREEN_MAX_LENGTH == 667.0)
#define IS_IPHONE_6P (IS_IPHONE && SCREEN_MAX_LENGTH == 736.0)

#define ISIOS7 ([[[[UIDevice currentDevice] systemVersion] substringToIndex:1] intValue]>=7)

#define APPDELEGATE ([UIApplication sharedApplication].delegate)

#define KBOARDCOLOR  ([UIColor whiteColor].CGColor)
#define KBOARDWIDTH  0.6
#define KGLOBLEBGCOLOR  [UIColor colorWithRed: 248.0/255.0 green: 248.0/255.0 blue: 248.0/255.0 alpha:1.0]
#define KAPPBOARDCOLOR  [UIColor colorWithRed:188.0/255.0 green:186.0/255.0 blue:193.0/255.0 alpha:1.0]
//#2197d4
#define KAPPMAINBLUECOLOR [UIColor colorWithRed: 33.3/255.0 green: 151.0/255.0 blue: 212.0/255.0 alpha: 1.0]

#define KAPPMAINYELLOWCOLOR [UIColor colorWithRed: 248.0/255.0 green: 183.0/255.0 blue: 5.0/255.0 alpha: 1.0]

//#5cc717 green
#define KAPPMAINGREENCOLOR [UIColor colorWithRed: 92.0/255.0 green: 199.0/255.0 blue: 23.0/255.0 alpha: 1.0]

//#ff0000 red
#define KAPPMAINREDREDCOLOR [UIColor colorWithRed: 255.0/255.0 green: 0.0/255.0 blue: 0.0/255.0 alpha: 1.0]

/*************沙盒路径*********************/
#define folderPath [NSSearchPathForDirectoriesInDomains(NSDocumentDirectory,NSUserDomainMask,YES) lastObject]
//#define csvFolderPath [folderPath stringByAppendingString:@"/csv"]
//#define ZipFolderPath   [folderPath stringByAppendingString:@"/data"]
//#define DATAFolderPath [folderPath stringByAppendingString:@""]
/*************头文件引入*********************/

/*************通讯录常量*********************/
#define WORKERS @"WORKERSUSER"

static CGFloat marginX = 40.;
static CGFloat marginY = 15.;

#define addTextViewHOneLine ((SCREEN_WIDTH - marginX * 5)/4 + 15 + 2 * marginY)
#define addTextViewHTwoLine ((SCREEN_WIDTH - marginX * 5)/2 + 30 + 3 * marginY)

// RGB 颜色
#define HSColor(r,g,b) [UIColor colorWithRed:(r)/255.0 green:(g)/255.0 blue:(b)/255.0 alpha:1.0]
#define HSMColor(r,g,b) [UIColor colorWithRed:(r) green:(g) blue:(b) alpha:1.0]
// 随机色
#define HSRandomColor HSColor(arc4random_uniform(256),arc4random_uniform(256),arc4random_uniform(256))

#define HEXCOLORARR @[@"#60b1f0",@"#5cc717",@"#46c8ed",@"#fab706",@"#ff731e",@"#edeb1d",@"#0dd2c6",@"#c339cf",@"#9059D1",@"#404FD0"]
#define CHARTDIDSELECTED @"Chart_didSelected"
#define CHARTSETFRAME @"chartSetFrame"

#define ISTEST NO //YES为测试(模拟器)环境，NO为真实环境
#define DEVICE_ID ISTEST ? @"12345678" : [OpenUDIDPush value]
#define DEVICE_TYPE ISTEST ? @"ANDROID" : @"IOS"

// 网址请求
#define HSLogFunc HSLog(@"%s", __func__)
//http://222.45.42.120:60117/nocshs/
//http://192.168.0.200:80/customService/
#define HSLoadDataUrl(url) [[NSString stringWithFormat:@"http://222.45.42.120:60117/customService/%@",(url)] stringByAddingPercentEncodingWithAllowedCharacters:[NSCharacterSet URLQueryAllowedCharacterSet]]
#define HSLoadDataTestUrl(url) [[NSString stringWithFormat:@"http://192.168.0.248:80/iAsInsight/%@",(url)] stringByAddingPercentEncodingWithAllowedCharacters:[NSCharacterSet URLQueryAllowedCharacterSet]]

#define BASE_URL @"http://222.45.42.120:60117/nocshs/"

#endif /* HSDefine_h */
